package vip.huhailong.rabbitmqdemo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import vip.huhailong.rabbitmqdemo.RabbitUtil;
import vip.huhailong.rabbitmqdemo.entity.FieldContent2;

import java.util.*;

/**
 * @author Huhailong
 * @Description
 * @Date 2021/11/18.
 */
@RestController
@RequestMapping("/msg")
public class SendMessageController {

    @Autowired
    RabbitUtil rabbitUtil;

    @GetMapping("/sendTest")
    public String sendDirectMessage(){
        String id = String.valueOf(UUID.randomUUID());
        String fieldName = "索引编号";
        String content = "1000";
        FieldContent2 fieldContent = new FieldContent2();
        fieldContent.setId(id);
        fieldContent.setFieldName(fieldName);
        fieldContent.setContent(content);
        List<FieldContent2> list = new ArrayList<>();
        list.add(fieldContent);
        rabbitUtil.importFieldContent(list);
        return "send success";
    }
}
